﻿Public Class Report

    Public Sections As New List(Of Section)

    Public Header As New Body

    Function AddSection() As Section
        Sections.Add(New Section)
        Return Sections.Last
    End Function

    Sub ShowAsWebpage()
        Dim Builder As New StringBuilder
        For Each Section In Sections
            Section.Prepare(Builder)
        Next
        Dim Report = My.Computer.FileSystem.SpecialDirectories.Temp & "\report.html"
        My.Computer.FileSystem.WriteAllText(Report, Builder.ToString(), False)
        System.Diagnostics.Process.Start(Report)
    End Sub

    Sub Prepare(ByVal Layout As Layout)
        Layout.Clear()
        For Each Section In Sections
            Section.Prepare(Layout)
        Next
    End Sub

	Sub Clear()
		Header = New Body
		Sections.Clear()
	End Sub

End Class

